<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>弹出选择组件</title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" content="no-siteapp,no-transform,no-store, no-cache, must-revalidate">
    <meta http-equiv="Pragma" content="no-cache">
    <link rel="shortcut icon" href="./../../../favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="./../../../static/css/font.css">
    <link rel="stylesheet" href="./../../../static/css/weadmin.css">
    <script type="text/javascript" src=".//lib/layui/layui.js" charset="utf-8"></script>
    <link rel="stylesheet" href="../../../static/css/buildUnit/common.css">
</head>
<body>
<div class="content">
    <form class="layui-form" id="view" action="">
    </form>
    <script type="text/html" id="templateId">
        <table class="layui-table" lay-skin="line" lay-even id="klmyTable">
            <colgroup>
                <col width="100">
                <col>
                <col>
                <col>
                <col>
                <col>
            </colgroup>
            <tbody>
            {{# layui.each(d.list, function(index, item){ }}
            <tr>
                <td>
                    <input type="radio" name="checkVal" value="{{item.value}}" title="" {{(d.selectVal!=='' &&
                           d.selectVal)===item.value?'checked':''}}/>
                </td>
                <td colspan="5">
                    {{item.name}}
                </td>
            </tr>
            {{# });}}
            </tbody>
        </table>
    </script>
</div>
<script src="../../../static/js/main.js"></script>
<script>
    var selectTemplate = {};
    layui.use(['permission', 'table', 'bluebird', 'jquery', 'element', 'form', 'templateInit'], function () {
        var $ = layui.$;
        var element = layui.element;
        var form = layui.form;
        var table = layui.table;
        var templateInit = layui.templateInit;
        selectTemplate = {
            data: {
                columnName: '名称',//列名
                selectVal: '',//默认选中的值
                list: []
            },
            render: function () {
                var templateHtml = $('#templateId').html();
                templateInit.init('view', selectTemplate.data, templateHtml);
                element.render('radio');
                form.render();
            }
        }
    });

    function selectRender(childTime, data) {
        clearTimeout(childTime);
        selectTemplate.data = data;
        selectTemplate.render();
    }

</script>
</body>
</html>